import http from "@/api";
import { ResPage } from "@/api/interface";

/**
 * @name 角色列表分页查询
 */
export const roleListPaginationQuery = (params: any): Promise<any> => {
  return http.post<ResPage<any>>('/roleManage/roleList', params);
};


// 新增角色
export const addRole = (params: any): Promise<any> => {
  return http.post('/roleManage/addRole', params);
};


// 编辑角色
export const editRole = (params: any): Promise<any> => {
  return http.post('/roleManage/rolesEdit', params);
};

//角色编辑详情
export const getRoleDetail = (params: any): Promise<any> =>
  http.get(`/roleManage/roleDetails/${params}`);

// 删除角色
export const deleteRole = (params: any) =>
  http.get(`/roleManage/deleteRole/${params}`);


//查询组织树列表
export const getOrgTreeList = (): Promise<any> => {
  return http.get('/roleManage/queryAllCompanyOrgTreeList');
};

//查询菜单权限树列表
export const getMenuList = (): Promise<any> => {
  return http.get('/roleManage/rolePerMissionSettings');
};

//获取全部角色
export const getAllRoleList = (): Promise<any> => {
  // const headers = {
  //   'Content-Type': 'application/x-www-form-urlencoded'
  // };
  return http.get<any>('/roleManagement/listOfRoles');
};
